package company.beike;

import java.util.Scanner;

public class BeiKe1 {

    static int min = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.nextLine();
        String s = sc.nextLine();
        helper(s, 0, 0);
        System.out.println(min);
    }

    private static void helper(String s, int index, int step) {
        if (index == s.length())
            return;
        if (judge(s)) {
            min = Math.min(min, step);
        } else {
            helper(s, index + 1, step);
            for (int i = index + 1; i < s.length(); i++) {
                helper(swap(s, index, i), index + 1, step + 1);
            }
        }
    }

    private static String swap(String s, int i, int j) {
        char[] chars = s.toCharArray();
        char tmp = chars[i];
        chars[i] = chars[j];
        chars[j] = tmp;
        return new String(chars);
    }

    private static boolean judge(String s) {
        int i = 0, j = s.length() - 1;
        while (i <= j) {
            if (s.charAt(i) != s.charAt(j))
                return false;
            i++;
            j--;
        }
        return true;
    }
}
